package cn.tedu.micro.demo.websocket.controller;

import cn.tedu.micro.demo.websocket.points.WesocketServerPoint;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class MsgController {
    @Autowired
    private WesocketServerPoint serverPoint;
    @GetMapping("/push")
    public String push(Integer userId,String msg){
        log.info("业务触发消息推送,给userId:{},推送消息msg:{}",userId,msg);
        boolean result=serverPoint.pushMsg(userId,msg);
        return result?"推送成功":"推送失败";
    }
}
